/***********************************************************************
    filename:   DaterTime.h
    created:    10/4/2012
    author:     4Ys

    purpose:    Defines a base class for time used in Dater
*************************************************************************/
#ifndef _DaterTime_h_
#define _DaterTime_h_

#include <time.h>
#include <string>

namespace Dater
{
	/*!
	\brief
		A base class contains time.
	*/
	class Time
	{
	public:

		/* !
		\brief
			Construct the sample of class Time
		*/
		Time();

		/* !
		\brief
			Destructor of the Time object
		*/
		~Time();

		/* !
		\brief
			Construct the sample of class Time with a param timeData

		\param timeData
			- to initialize the time with it
		*/
		Time(int* timeData);

		/*!
		\brief
			Construct the sample of class Time with a param tm*

		param timeData
			- to initialize the time with the given tm struct
		*/
		Time(tm* timeData);

		Time(std::string day, std::string time = "");

		/*!
		\brief
			Construct the sample of 
		*/
		Time(const Time& time);

		/*!
		\brief
			Deep copy of operator=
		*/
		Time& operator=(const Time& time);
		
		/* !
		\brief
			Set the exactic time of a sample of class Time
		*/
		void setTime();

		/* !
		\brief
			Set the exactic time of a sample of class Time
		*/
		void setTime(int* timeData);

		/* !
		\brief
			Set the exactic time of a sample of class Time
		*/
		void setTime(tm* timeData);
		
		/* !
		\brief
			get the time of a sample of class Time

		\return
			a pointer point to a common time struct tm object
		*/
		tm* getTime();

		/*!
		\breif
			get the raw time of a sample of class Time

		\return
			the raw time
		*/
		time_t getRawTime();

		/*!
		\breif
			get the second between this and the parameter time

		\param
			a given time to differ

		\return
			seconds between two times
		*/
		int getTimeDiffer(const Time& time) const;

	private:
		/* !
			_rawTime: current time
		*/
		time_t _rawTime;

		/* !
			_commonTime: the exact time of setting 
		*/
		tm* _commonTime;

	public:
		static tm* _todayTime;
	};

}

#endif